<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"><!-- InstanceBegin template="/Templates/cloudiary.dwt" codeOutsideHTMLIsLocked="false" -->
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<!-- InstanceBeginEditable name="doctitle" -->
<title>Cloudiary</title>
<!-- InstanceEndEditable -->
<!-- InstanceBeginEditable name="head" -->
<link rel="stylesheet" type="text/css" href="test/style.css" />
<link href='http://fonts.googleapis.com/css?family=Open+Sans+Condensed:300|Playfair+Display:400italic' rel='stylesheet' type='text/css' />

<noscript>
	<link rel="stylesheet" type="text/css" href="test/noscript.css" />
</noscript>

<script type="text/javascript" src="Js/jquery.js"></script>
<script type="text/javascript" src="Js/login.js"></script>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js?ver=1.4.2"></script>
<!-- InstanceEndEditable -->
<link href="CSS/css.css" rel="stylesheet" type="text/css" />
</head>
<?php
include("config.php");
if($_SERVER["REQUEST_METHOD"] == "POST")
{
// username and password sent from Form 
$myemail=addslashes($_POST['email']); 
$mypassword=addslashes($_POST['password']); 

$sql="SELECT * FROM user WHERE user_email ='$myemail' and user_password ='$mypassword'";
$result=mysql_query($sql);
$row=mysql_fetch_array($result);
$active=$row['active'];
$count=mysql_num_rows($result);

session_start();
// If result matched $myemail and $mypassword, table row must be 1 row
if($count==1)
{
	if($row['is_admin'] == 1)
	{
		$_SESSION['login_user']=$myemail;
		header("location: AdminAccounts.php");
	}
	else if ($row['is_admin'] == 0)
	{
		$_SESSION['login_user']=$myemail;
		header("location: Home.php");
	}
	
}
else 
{
	echo "<script type='text/javascript'> alert('Wrong username and/or password')</script>";
}


}
?>
<body>
<div id="container">
<div id="wrapper">

<div id="header">
<!-- InstanceBeginEditable name="header" -->
<div class="login">
<table border="0">
<tr>
<td>
<a href="#" id="loginButton"><span>Login</span><em></em></a>
<div style="clear:both"></div>
<div id="loginBox">                
<form id="loginForm" method="POST">
<fieldset id="body">

<fieldset>

<input type="email" name="email" id="email" placeholder="Email Address" required/>
</fieldset>

<fieldset>
<input type="password" name="password" id="password" placeholder="Password" required/>
</fieldset>

<input type="submit" id="login" value="Login" />
</fieldset>
</form>
</div>
</td>
<td>
<a href="Register.php" id="registerButton"><span>Register</span></a>
</td>
</tr>
</table>
</div>
<!-- InstanceEndEditable -->

<img src="Assets/cloud diary low-01(trans).png" alt="CloudDiary" width="75" height="45" style="padding:5px 10px;" /> <br />
</div>

<div id="main">
<!-- InstanceBeginEditable name="main" -->
<div class="container">

<div class="wrapper">
<div id="ei-slider" class="ei-slider">
	 <ul class="ei-slider-large">
	<li>
	<img src="Assets/InspirationalDiary.png" alt="image06"/>
	</li>
	
    <li><img src="Assets/Beyond.png" alt="image01"/></li>
	
    <li>
	<img src="Assets/ExpressyYourself.png" alt="image02"/>
	</li>
    </ul><!-- ei-slider-large -->
	
    <ul class="ei-slider-thumbs">
	<li class="ei-slider-element">Current</li>
	<li><a href="#">Slide 1</a><img src="Assets/InspirationalDiary.png" alt="thumb06" /></li>
    <li><a href="#">Slide 2</a><img src="Assets/Beyond.png" alt="thumb01" /></li>
    <li><a href="#">Slide 3</a><img src="Assets/ExpressyYourself.png" alt="thumb02" /></li>
    </ul><!-- ei-slider-thumbs -->
	</div><!-- ei-slider -->
</div><!-- wrapper -->
</div>

<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.0/jquery.min.js"></script>

<script type="text/javascript" src="test/jquery.eislideshow.js"></script>

<script type="text/javascript" src="test/jquery.easing.1.3.js"></script>

<script type="text/javascript">
$(function() {
	$('#ei-slider').eislideshow({
		animation			: 'center',
		autoplay			: true,
		slideshow_interval	: 3000,
		titlesFactor		: 0
	});
});
</script>
<!-- InstanceEndEditable -->
</div>

</div>
</div>

<div id="footer">
<p align="center"> &copy; &nbsp; 2012 CloudDiary </p>
</div>
</body>
<!-- InstanceEnd --></html>
